<?php
    $APIMaxPage = 5;
		$transform = new Transform();

		$XmlOrJson = "XML";
		$ListModel = array(
			"Available"	=> "TotalResults",//all count
			"item"		=> array(
								"Item=>{n}"	=> array(
										"site"		=> "amazon",
										"title"		=> "ItemAttributes=>Title",
										"itemid"	=> "ASIN",
										"img"		=> "SmallImage=>URL",
										"price"		=> "Offers=>Offer=>OfferListing=>Price=>Amount",
										"bidorbuy"	=> "",
										"store"		=> "",
										"NewItem"	=> "",
										"bids"		=> "",//auction
										"starttime"	=> "",
										"endtime"	=> "",
										"timeleft"	=> "",
								)
							)
		);
		$ItemModel = array(
			"title"		=> "Item=>ItemAttributes=>Title",
			"itemid"	=> "Item=>ASIN",
			"img"		=> "Item=>MediumImage=>URL",
			"url"		=> "Item=>DetailPageURL",
			"price"		=> "Item=>Offers=>Offer=>OfferListing=>Price=>Amount",//現在価格です
			/////////////////////////////////////////////
			"availability"		=> "Item=>Offers=>Offer=>OfferListing=>Availability",//在庫あり
			//"OfferListingId"		=> "Item=>Offers=>Offer=>OfferListing=>OfferListingId",//amazon
			"listPrice"	=> "Item=>ItemAttributes=>ListPrice=>Amount",//原价
			"starttime"	=> "Item=>ItemAttributes=>ReleaseDate",
			"color"		=> "Item=>ItemAttributes=>Color",
			"height"	=> "Item=>ItemAttributes=>PackageDimensions=>Height",
			"width"		=> "Item=>ItemAttributes=>PackageDimensions=>Width",
			"weight"	=> "Item=>ItemAttributes=>PackageDimensions=>Weight",
			"lenght"	=> "Item=>ItemAttributes=>PackageDimensions=>Length",
			"SalesRank"	=> "Item=>SalesRank",//销量排行
			/////////////////////////////////////////////
			"quantity"	=> "Item=>Offers=>Offer=>OfferListing=>Quantity",//商品の数量です。-1=还有很多
			"bidorbuy"	=> "",//即決価格です
			"bids"		=> "",//現在の入札数です
			"condition"	=> "Item=>Offers=>Offer=>OfferAttributes=>Condition",//商品の状態です。
			"endtime"	=> "",
			"remaintime"=> "",//残り時間
			"store"		=> "",//有 StoreIcon :オークションストアの出品   无:一般の出品者の出品
			"postageFlag"		=> "",//「送料無料」のアイコンのURLです。
			"taxFlag"		=> "",//0：税込1：税別
			"itemCaption"		=> "Item=>EditorialReviews=>EditorialReview=>Content"//商品説明文
		);

		$isfix= false;
		$ACCESS_KEY = "AKIAJ3AS5HF6GECWRENQ";
		$SECRET_KEY = "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";
		$AssociateTag= "fromjapan00d-22";
		$Service = "AWSECommerceService";
		$Version = "2010-08-06";
		//$ResponseGroup = "Medium,ItemAttributes,OfferFull,Offers";
		$ResponseGroup = "Medium,ItemAttributes,Offers";
		//$ResponseGroup = "BrowseNodes,Images,ItemAttributes,OfferFull,Reviews";//SHOPPINGFINDER.jp
		$host = "ecs.amazonaws.jp";
		$uri = "/onca/xml";
		$ItemUrl = "http://".$host.$uri."?";
		$ListUrl = $ItemUrl;//?SearchIndex=Blended&Keywords=ipod
		$Category = array(
        "All"			=>	"All",//所有
				"Watches"		=>	"Watches",//钟表アクセサリー、時計
				"Apparel"		=>	"Apparel",//服装
				"HealthPersonalCare"	=>	"HealthPersonalCare",//健康个人护理
				"Software"		=>	"Software",//软件
				"Electronics"	=>	"Electronics",//电子 家電、'
				"Kitchen"		=>	"Kitchen",//厨房ズ|漫画
				"Toys"			=>	"Toys",//玩具おもちゃ、ゲーム
				"VideoGames"	=>	"VideoGames",//电子游戏
				"Baby"			=>	"Baby",//宝贝
				"SportingGoods"	=>	"SportingGoods",//体育用品
				"Music"			=>	"Music",//音乐
				"DVD"			=>	"DVD",//DVD
				"Books"			=>	"Books",//书籍
				"ForeignBooks"	=>	"ForeignBooks",//外文图书
				"Blended"		=>	"Blended",//其他
				"Classical"		=>	"Classical",//古典
				"MusicTracks"	=>	"MusicTracks",//音乐曲目
				"VHS"			=>	"VHS",//录像带
				"Video"			=>	"Video",//映画、ビデオ
        
        
        
				//"Automotive"	=>	"Automotive",//汽车
				//"Beauty"		=>	"Beauty",//美容ビューティー
				//"Grocery"		=>	"Grocery",// キッチン、生活雑貨、日用品
				//"Hobbies"				=>	"Hobbies",//爱好 ホビー
				//"HomeImprovement"		=>	"HomeImprovement",//家居改善住まい、インテリア
				//"Jewelry"		=>	"Jewelry",//珠宝
				//"MusicalInstruments"	=>	"MusicalInstruments",//乐器
				//"OfficeProducts"=>	"OfficeProducts",//办公产品 事務、店舗用品 文具
				//"Shoes"			=>	"Shoes",//鞋
			);
		
		$SortOrder = array(
			"end,A"		=>	"",
			"end,D"		=>	"daterank",
			"price,A"	=>	"-price",
			"price,D"	=>	"price",
			"bids,A"		=>	"",
			"bids,D"		=>	"salesrank"
		);

		$ItemParam = array(
			"Service"        => $Service,
			"Version"        => $Version,
			"AWSAccessKeyId" => $ACCESS_KEY,
			"AssociateTag" => $AssociateTag,
			"Operation"      => "ItemLookup",
			"ItemId"         => _GET("itemid"),
			"ResponseGroup"  => $ResponseGroup,
			"Timestamp"      => gmdate("Y-m-d\TH:i:s\Z"),
			"Signature"      => ""
		);
		$oldsearchcate = checknull("id", checknull(_GET("c"), $SiteCate["shopping"]["amazon"]),"Blended");

		$ListParam = array(
			"Service"        => $Service,
			"Version"        => $Version,
			"AWSAccessKeyId" => $ACCESS_KEY,
			"AssociateTag" => $AssociateTag,
			//"Condition"      => "ALL",
			"Operation"      => "ItemSearch",
			"Keywords"       => $keyword,
			//"SearchIndex"    => empty($Category[$_GET["c"]])?"All":$Category[$_GET["c"]],
			"SearchIndex"    => $oldsearchcate,
			"SearchIndex_all"    => checknull("amazon", checknull(_GET("c"), $SiteCate["shopping"]["all"])),
			"Brand"          => "",
			"ItemPage"       => $pagenum,
			"Manufacturer"   => "",
			"MaximumPrice"   => _GET("Maxprice"),
			"MinimumPrice"   => _GET("Minprice"),
			//"Sort"           => empty($_GET["s"])?"":$SortOrder[$_GET["s"]],
			"Sort"           => checknull(_GET("s"), $SortOrder),
			"ResponseGroup"  => $ResponseGroup,
			"Timestamp"      => gmdate("Y-m-d\TH:i:s\Z"),
			"Signature"      => ""
		);
		
		$ItemParam = $transform->GetRequest($ItemParam);
		$ListParam = $transform->GetRequest($ListParam);
		
		
		$ListParam["Signature"] = GetSignature($transform,$host,$uri,$SECRET_KEY,$ListParam);
		$ItemParam["Signature"] = GetSignature($transform,$host,$uri,$SECRET_KEY,$ItemParam);
?>